//
//  FirstViewController.m
//  界面通信
//
//  Created by dllo on 16/7/25.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "FirstViewController.h"
#import "SecondViewController.h"

@interface FirstViewController ()

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(70, 300, 70, 30);
    button.backgroundColor = [UIColor redColor];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    [button setTitle:@"小子" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
//    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40, 400, 100, 30)];
//    label.backgroundColor = [UIColor yellowColor];
//    label.text = @"其实";
//    [self.view addSubview:label];
}

- (void)did
{
    NSLog(@"ddddd");
}
    

- (void)buttonClicked:(UILabel *)label
{
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(40, 400, 100, 30)];
    label1.backgroundColor = [UIColor yellowColor];
    label1.text = @"其实";
    [self.view addSubview:label1];
    SecondViewController *svc = [[SecondViewController alloc] init];
    svc.secondDelegate = self;
//    svc.contents = label1.text;
    [self.navigationController pushViewController:svc animated:YES];
}

- (void)changeValue:(NSString *)name
{
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(40, 400, 100, 30)];
    label1.backgroundColor = [UIColor yellowColor];
    label1.text = @"其实";
    [self.view addSubview:label1];
    label1.text = name;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
